<!DOCTYPE html>
<html>
<head>
    <title>用户管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src="https://api.map.baidu.com/getscript?v=2.0&ak=IrvvMGT2E0khbG2b8pBTEHGiMkKU9CTR"></script>
    <link href="Success.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="jquery.js"></script>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet">
</head> 
<body>
    <div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom box-shadow">
        <h5 class="my-0 mr-md-auto font-weight-normal"><b>Js</b> 课程设计</h5>
    </div>
        <a class="btn btn-outline-primary" href="LogIn.html" id = "Log">注册 / 登录</a>
        <a class="btn btn-outline-primary" href="LogIn.html" id = "Cancel"> 注销 </a>
        <a class="btn btn-outline-primary" id = "User">个人中心</a>
    </div>
    <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center"  id = "login">
        <h1 class="display-5">欢迎</h1>
        <p class="lead">请点击右上角 “注册 / 登录” 按钮以进入用户管理系统</p>
    </div>
    <div id="allmap"></div>
<script>
    $(document).ready(function () {
        var map = new BMap.Map("allmap");    // 创建Map实例
        map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
        //添加地图类型控件
        map.addControl(new BMap.MapTypeControl({
        mapTypes:[
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
        ]}));     
        map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
        map.enableScrollWheelZoom(true);
        var url = location.search;          //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
        $('#login').fadeIn("slow");
        $('#login p').text ("调用百度地图API：")
        $('#Log').hide();
        $('#Cancel').show();
        $('#allmap').fadeIn("slow");
        var str = url.substr(1);
        strs = str.split("&");
        for(var i = 0; i < strs.length; i ++) {
            theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
        }
        var username = theRequest["username"];
        var b = localStorage.getItem(username);
        var data = JSON.parse(b);
        $("#Username").text("用户名:"+username);
        $("#Email").text("邮箱:"+data.email);
        $("#RegistTime").text("注册时间:"+data.date.replace(/.252Z/, ""));
    }else{      
        $('#allmap').hide();
        $('#User').hide();
        $("#login").fadeIn("slow");
        $('#Cancel').hide();
    }
    $('#User').click(function(){
        window.location.href= "User.html?username=" + username;
        window.event.returnValue = false;
    })
});
</script>
</body>
</html>